// 仓库
// import { createApp } from 'vue'
import { createStore } from 'vuex'

import getters from './getters'


// 引入小仓库
import defectInfo from './defectInfo';

export default createStore({
  state: {
    sideBarType: true,
    // 当前干线名字
    currentTruckLine: '',
    // 当前管段id
    currentPipelineId: '12312',
    centerMap: ''
  },
  mutations: {
    changeSideBarType(state, condition) {
      state.sideBarType = condition
    },
    changeCurrentTruckLine(state, currentTruckLine) {
      state.currentTruckLine = currentTruckLine
    },
    changeCurrentPipeLineId(state, currentPipelineId) {
      state.currentPipelineId = currentPipelineId
    },
    setCenterMapValue(state, map) {
      state.centerMap = map
    }
  },
  actions: {
    handleChangeCurrentTruckLine(context, currentTruckLine) {
      context.commit('changeCurrentTruckLine', currentTruckLine)
    },
    handleChangeCurrentPipeLineId(context, currentPipelineId) {
      context.commit('changeCurrentPipeLineId', currentPipelineId)
    }
  },

  // 注册小仓库
  modules: {
    defectInfo
  },
  getters
})

// const app = createApp({ /* 根组件 */ })

// // 将 store 实例作为插件安装
// app.use(store)
